package com.xzy.fruitmall.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xzy.fruitmall.CustomerService;
import com.xzy.fruitmall.entity.CustomerInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sgg")
public class TestController {
    @Autowired
    private CustomerService customerService;

    @GetMapping(value = "/test")
    public String test(){
        List<CustomerInfo>list=customerService.findAllCustomer();
        String str="{\"code\":1,\"msg\":\"成功\",\"data\":";
        str+=JSONArray.toJSONString(customerService.findAllCustomer())+"}";
        return str;
    }
}
